import { runCommand } from '../util/subprocess';
import { getOhosStudioPath } from './common';

export async function openOhos(config: any): Promise<void> {
  const studioPath = await getOhosStudioPath();
  
  try {
    await runCommand('cmd', ['/c', 'start', '', `"${studioPath}"`, config.ohos.platformDirAbs], {
      cwd: config.ohos.platformDirAbs,
    });
  } catch (e) {
    throw new Error(`Failed to open DevEco Studio: ${e}`);
  }
}